C Program to compute the series
#include<stdio .h="">
#include<conio .h="">
int fact(int no)
{
int i,f=1;
for(i=1;i<=no;i++)
{
f=f*i;
}
return f;
}
void main()
{
int j,n;
float s=0,f;
clrscr();
printf("\nEnter the value of n: ");
scanf("%d",&n);
for(j=1;j<=n;j++)
{
f=fact(j);
s=s+1/f;
}
printf("Value of s is %0.3f",s);
getch();
}
************OUTPUT**************
Enter the value of n: 5
Value of s is 1.717</conio></stdio>